#pragma once

#include "LevelElement.h"
class CubePhysX;
class NxShape;
class Character;
class PhysX;
class DX10ObjMesh;
class D3DApp;
class Level;
/**
* This class creates a pickable item by adding a ghost object
* that encapsulates it. When a player character "triggers" the ghost
* object the object will be added to the inventory of the player character.
* @author Koen Samyn
*/
class Key : public LevelElement
{
public:
	/**
	* Creates a new pickable item.
	*/
	Key(Level* level, PhysX* physics,int id,D3DXVECTOR3 pos, bool rotate, D3DApp *app);

	/**
	* Destroys the pickable item.
	*/
	virtual ~Key(void);

	/**
	* Override this method to implement the physics behaviour of this object.
	*/
	virtual void Tick(const InputState&  dTime);

	/**
	* Draw the D3DObject in the scene.
	* Needs definition in derived class
	*/
	virtual void Draw(const RenderContext* context, ID3D10ShaderResourceView* shadowdepthmap = 0) ;
	/*************************************************************************
	* implement this in derived class to initalize
	*/
	virtual void Initialize(ContentManager *pContentManager);


	/**
	* Called when the trigger is entered.
	*/
	virtual void OnTriggerEnter(Character* player);

	/**
	* Called when the trigger is left.
	*/
	virtual void OnTriggerExit(Character* player);

	/**
	* Disable calling OnTriggerEnter and OnTriggerExit.
	*/
	virtual void DisableTrigger();
	int GetID(){return m_ID;}
private:

	virtual void BuildDrawMesh();

	/**
	* The object to show
	*/
	DX10ObjMesh* m_pDrawMesh;

	/**
	* The trigger object
	*/
	CubePhysX* m_pTrigger;

	/**
	* Rotate the object or not.
	*/
	bool m_Rotate;

	/**
	* The original position
	*/
	D3DXVECTOR3 m_Position;

	/**
	* The rotation of the y axis.
	*/
	float m_yRot;

	/**
	* The id of the pickable item.
	*/
	int m_ID;
	/**
	*
	*/
	PhysX* m_pPhysX;
	D3DApp* m_app;
};
